<?php
/**
 * 活动的会员
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019-04-27
 * Time: 下午 7:11
 */
namespace App;

use Model\ActivityMemberMod;

class ActivityMember extends Action
{
    private $ActivityMember = null;
	public function __construct()
	{
		parent::__construct();
		$this->ActivityMember = new ActivityMemberMod();
	}

    /**
     * 根据前端传过来的时间段返回每日新增的会员数量
     * @param activity_id 活动id
     * @param times 时间段['2018-10-19','2018-10-20'....]
     */
    public function activityMemberNumber()
    {
        $_number = array();
        $_join_number = array();
        $_times = $this->_gpc['times'];
        foreach($_times as $_v){
            $_times = strtotime($_v);
            $_end_times = $_times + 86400;
            array_push($_number,$this->ActivityMember->activityMemberNumber($this->_gpc['activity_id'],strtotime($_v)));
            array_push($_join_number,$this->ActivityMember->activityMemberJoinNumber($this->_gpc['activity_id'],strtotime($_v)));
        }
        $this->_result = array('status'=>'success','data'=>array('total_number'=>$_number,'join_number'=>$_join_number));
        $this->result($this->_result);
    }
}